package cn.edu.scau.cmi.linyiqu.composite.consistent;

import java.util.Set;

public class ConsistentPerson extends ConsistentComponent {
	private String name;

	public ConsistentPerson(String name) {
		this.name = name;
	}

	@Override
	public String show(int indentation) {
		StringBuilder string = new StringBuilder();
		int i = indentation;
		while ((i--) > 0)
			string.append('\t');
		return string.toString() + "Person: " + this.getName() + '\n';
	}

	@Override
	public ConsistentComponent addChild(ConsistentComponent child) {
		System.out.println("该部件不可添加子部件");
		return null;
	}

	@Override
	public ConsistentComponent removeChild(ConsistentComponent child) {
		System.out.println("该部件没有子部件");
		return null;
	}

	@Override
	public Set<ConsistentComponent> getChildrenSet() {
		System.out.println("该部件没有子部件");
		return null;
	}

	@Override
	public void setChildrenSet(Set<ConsistentComponent> childrenSet) {
		System.out.println("该部件不可以添加子部件");
	}

	@Override
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}